home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / prolog / sbprolog / amiga / c_src2_5.zoo / sim.h < prev    next >
C/C++ Source or Header  |  1988-08-07  |  4KB  |  132 lines

  1. /************************************************************************
  2. *                                    *
  3. * The SB-Prolog System                            *
  4. * Copyright SUNY at Stony Brook, 1986; University of Arizona, 1987    *
  5. *                                    *
  6. ************************************************************************/
  7.  
  8. /*-----------------------------------------------------------------
  9. SB-Prolog is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY.  No author or distributor
  11. accepts responsibility to anyone for the consequences of using it
  12. or for whether it serves any particular purpose or works at all,
  13. unless he says so in writing.  Refer to the SB-Prolog General Public
  14. License for full details.
  15.  
  16. Everyone is granted permission to copy, modify and redistribute
  17. SB-Prolog, but only under the conditions described in the
  18. SB-Prolog General Public License.   A copy of this license is
  19. supposed to have been given to you along with SB-Prolog so you
  20. can know your rights and responsibilities.  It should be in a
  21. file named COPYING.  Among other things, the copyright notice
  22. and this notice must be preserved on all copies. 
  23. ------------------------------------------------------------------ */
  24.  
  25. /* sim.h */
  26.  
  27. #include <stdio.h>
  28. #include <math.h>
  29.  
  30.  
  31. #define maxregs       257
  32. #define maxtraps      2
  33. #define WRITEFLAG     1
  34. #define READFLAG      0
  35. #define max_len       1280
  36. #define bucket_chain  53
  37. #define null          0
  38. #define true          1
  39. #define false         0
  40. #define PERM           1
  41. #define TEMP          0
  42. #define CAR           1
  43. #define CDR          0
  44.  
  45. #define T_ORDI  0    /* constant-type: no ep definition */
  46. #define T_DYNA    1    /* constant-type: dynamic, code in buffer */
  47. #define T_PRED  2    /* constant-type: ep points to compiled code */
  48. #define T_BUFF  3    /* constant-type: no ep field at all */
  49. #define T_TEMP_PRED 15    /* psc entry for predicate containing offset
  50.                 entry point */
  51.  
  52. #define MAXINT     268435455
  53.  
  54. /* ------------ Type Specifiers --------------------------------------- */
  55.  
  56. typedef unsigned char byte;
  57. typedef unsigned long word;
  58. typedef byte *pb;
  59. typedef word *pw;
  60.  
  61. struct psc_rec {
  62.     byte entry_type;
  63.     byte arity;
  64.     unsigned short length;
  65.     char  *nameptr;
  66.     byte  *ep;      /* entry point, various meaning */
  67. };
  68.  
  69.  
  70. /* --------- External variable declarations -------------------------------- */
  71.  
  72. extern int maxmem, maxpspace, maxtrail;
  73.  
  74. extern word     *memory;   /* heap, local stack   */
  75. extern word     *pspace; /* psc records, instructions, p-names */
  76. extern word     *tstack;
  77. extern word     reg[maxregs];     /* registers */
  78. extern byte     *trap_vector[maxtraps];
  79. extern word    *hash_table[bucket_chain][2];
  80.  
  81. extern word *local_bottom;
  82. extern word *heap_bottom;
  83. extern word *trail_bottom;
  84.  
  85. extern byte *curr_fence; /* ptr to next free byte in perm space */
  86. extern byte *max_fence; /* ptr to last+1 free byte in perm space */
  87. extern byte *inst_begin; /* ptr to the beginning of inst. array */
  88.  
  89. extern word *ereg;                /* last activation record       */
  90. extern word *breg;                /* last choice point            */
  91. extern word *hreg;                /* top of heap                  */
  92. extern word *trreg;               /* top of trail stack           */
  93. extern word *hbreg;               /* heap back track point        */
  94. extern word *sreg;                /* current build or unify field */
  95. extern byte *cpreg;      /* return point register        */
  96. extern byte *pcreg;    /* program counter              */
  97.  
  98. extern word oprnd1, oprnd2, oprnd3;
  99.  
  100. extern byte flag;   /* read/write mode flag            */
  101.  
  102. extern word flags[10];  /* user flags, -u[0-9], from command line */
  103. extern byte trace;     /* 1 = trace on, 0 = trace off     */
  104. extern byte hitrace;   /* 1 = hitrace on, 0 = hitrace off */
  105. extern byte overflow_f; /* 1 = ignore stack overflow */
  106. extern byte disassem;
  107. extern byte trace_sta;  /* 1 = keep max stack size stats */
  108. extern byte call_intercept; /* hitrace or trace_sta for efficiency */
  109.  
  110. extern word term ;  /* defined in "unsafe.c" ?? */
  111.  
  112. extern int pcstop;  /* used in "dis.c" ?? */
  113.  
  114. extern int num_line;
  115.  
  116. extern word nil_sym, list_str;
  117.  
  118. extern struct psc_rec *interrupt_psc;
  119. extern struct psc_rec *list_psc;
  120. extern struct psc_rec *comma_psc;
  121.  
  122. extern int pspace_used; /* heap_used, stack_used, trail_used; */
  123. extern pw mheaptop, mlocaltop, mtrailtop;
  124.  
  125. extern byte *sav_pcreg, *sav_ereg; /* to save old values of pcreg and ereg to handle
  126.                   saving of Prolog states correctly */
  127.  
  128. extern int interrupt_code;
  129.  
  130.  
  131.  
  132.